package chixing.day13.homework.work3;

import java.util.Objects;

public class Product {
    private int pId;
    private String pName;
    private double pPrice;

    public Product(int pId, String pName, double pPrice) {
        this.pId = pId;
        this.pName = pName;
        this.pPrice = pPrice;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Product product = (Product) o;
        return pId == product.pId && Double.compare(product.pPrice, pPrice) == 0 && Objects.equals(pName, product.pName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pId, pName, pPrice);
    }

    public int getpId() {
        return pId;
    }

    public void setpId(int pId) {
        this.pId = pId;
    }

    public String getpName() {
        return pName;
    }

    public void setpName(String pName) {
        this.pName = pName;
    }

    public double getpPrice() {
        return pPrice;
    }

    public void setpPrice(double pPrice) {
        this.pPrice = pPrice;
    }

    @Override
    public String toString() {
        return "Product{" +
                "pId=" + pId +
                ", pName='" + pName + '\'' +
                ", pPrice=" + pPrice +
                '}';
    }
}
